import request from '@/utils/request'
import type {
  LoginApiResponse,
  GetUserInfoApiResponse,
} from './model/loginModel'
enum Api {
  login = '/admin/acl/index/login',
  logout = '/admin/acl/index/logout',
  getUserInfo = '/admin/acl/index/info',
}

// 登录
export const loginApi = (username: string, password: string) => {
  return request.post<any, LoginApiResponse>(Api.login, { username, password })
}

// 登出
export const logoutApi = () => {
  return request.post<any, null>(Api.logout)
}

// 获取用户信息
export const getUserInfoApi = () => {
  return request.get<any, GetUserInfoApiResponse>(Api.getUserInfo)
}